﻿@model MvcCmsProjectTracker.ViewModels.TicketIndexViewModel
@section HtmlHead{
}
<div id="activeprojectdisplay">
    @Html.Partial("ControlsProjectTracker/ActiveProject")
</div>
<p>    
    <a href="/projecttracker/Project/@Model.ActiveProjectID/Ticket/Create" class="button">Create Ticket</a>
</p>
<br />
<table style="width: 100%">
    <tr>
        <th>
            Ticket ID
        </th>
        <th style="width: 25%">
            Title
        </th>
        <th>
            Priority
        </th>
        <th>
        </th>
        <th>
            Status
        </th>
        <th>
        </th>
        <th>
            Creator
        </th>
        <th>
            Assigned
        </th>
        <th>
            Created
        </th>
        <th>
            Last Update
        </th>
    </tr>
    @foreach (var item in Model.Tickets)
    { 
        <tr>
            <td style="text-align: center">
                <a href="/projecttracker/Project/@Model.ActiveProjectID/Ticket/Edit/@item.TicketID">@item.TicketID</a>
            </td>
            <td>
                <b>@item.Title </b>
            </td>
            <td>
                @if (item.ProjectPriority != null)
                {  
                    @item.ProjectPriority.Name
                }
            </td>
            <td>
                @if (item.ProjectPriority != null)
                {  
                    <img src="@Url.Content(item.ProjectPriority.ImageUrl) " alt="" />
                }
            </td>
            <td>
                @if (item.ProjectStatus != null)
                {  
                    @item.ProjectStatus.Name 
                }
            </td>
            <td>
                @if (item.ProjectStatus != null)
                {  
                    <img src="@Url.Content(item.ProjectStatus.ImageUrl) " alt="" />
                }
            </td>
            <td>
                @item.CreatedBy.UserName
            </td>
            <td>
            @if (item.AssignedTo != null)
            {
                @item.AssignedTo.UserName
            }
            else
            {
                <text>N/A</text>
            }
            </td>
            <td>
                @String.Format("{0:g}", item.DateCreated)
            </td>
            <td>
                @String.Format("{0:g}", item.LastUpdate)
            </td>
        </tr>
    }
</table>
@section ScriptContent{
}
